<div ng-controller="CarSearchCtrl as vm">
<h1 class="page-title">搜索车辆</h1>
<div class="well">
<div class="form-horizontal" ng-submit="vm.searchCar()">
    <fieldset>
    <div class="control-group">
          <!-- Text input-->
          <label class="control-label" for="input01">车牌号</label>
          <div class="controls">
            <input type="text" placeholder="" class="input-xlarge" ng-model="vm.car.vehicleNumber">
            <p class="help-block"></p>
          </div>
    </div>
        <div class="control-group">
            <!-- Text input-->
            <label class="control-label" for="input01">审核状态</label>
            <div class="controls">
                <select  ng-model="vm.approvalStatus">
                    <option value="0">全部</option>
                    <option value="1">未审核</option>
                    <option value="2">审核中</option>
                    <option value="3">审核通过</option>
                    <option value="4">审核未通过</option>
                </select>
                <p class="help-block"></p>
            </div>
        </div>
        <div class="control-group">
          <label class="control-label"></label>
          <!-- Button -->
          <div class="controls">
            <button class="btn btn-primary" ng-click="vm.searchCar()">搜索</button>
          </div>
        </div>

    </fieldset>
  </div>
    <p ng-show="vm.noRecord">没有找到符合条件的车辆！</p>
        <div class="table-responsive" ng-show="vm.cars.length>0" >
          <form method='POST' action='/api/vehicle/export'>
            <input name="vehicleNumber" ng-model="vm.car.vehicleNumber" hidden/>
            <input name="approvalStatus" ng-value="vm.approvalStatus!=0? vm.approvalStatus:''" hidden/>
            <button class="btn" type="submit">导出结果</button>
          </form>
            <table class="table table-striped table-bordered">
                <thead>
                <tr>
                    <th>车牌号</th>
                    <th>挂车牌号</th>
                    <th>行驶证号</th>
                    <th>挂靠企业</th>
                    <th>车辆型号</th>
                    <th>审核通过？</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr ng-repeat="car in vm.cars">
                    <td><a ng-click="vm.viewDetail(car.id)">{{car.vehicleNumber}}</a></td>
                    <td>{{car.trailerNumber}}</td>
                    <td>{{car.vehicleLicenseNumber}}</td>
                    <td>{{car.employer}}</td>
                    <td>{{car.model}}</td>
                    <td ng-switch='car.approvalStatus'>
                        <div ng-switch-when="0">未审核</div>
                        <div ng-switch-when="1">审核中</div>
                        <div ng-switch-when="2">审核通过</div>
                        <div ng-switch-when="3">审核未通过</div>
                    </td>
                    <td>
                    <a class="btn btn-primary btn-mini" ng-click="vm.viewDetail(car.id)">查看</a>
                        <a class="btn btn-mini" ng-show="car.approvalStatus==0" ng-click="vm.submitVerify(car.id)">提交审核</a>
                    </td>
                </tr>
                </tbody>
            </table>
              <div class="pagination pagination-centered">
        <ul>
         <li ng-class="vm.firstPage? 'disabled':''" ng-switch="vm.firstPage">
         <a ng-switch-when="false" ng-click="vm.loadPage(vm.currentPage-1)" >&laquo;</a>
         <a ng-switch-when="true" >&laquo;</a>
         </li>
          <li ng-repeat="me in vm.pages" ng-class="me==vm.currentPage? 'active':''" ng-switch="me==vm.currentPage">
            <a ng-switch-when="false" ng-click="vm.loadPage(me)" >{{me}}</a>
            <a ng-switch-when="true" >{{me}}</a>
            </li>
          <li ng-class="vm.lastPage? 'disabled':''" ng-switch on="vm.lastPage">
          <a ng-switch-when="false" ng-click="vm.loadPage(vm.currentPage+1)">&raquo;</a>
          <a ng-switch-when="true" >&raquo;</a>
          </li>
        </ul>
      </div>
        </div>
    </div>
</div>